package com.example.health_life.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;

public interface OrderitemRepository extends JpaRepository<Orderitem, Integer> {
    // 根据订单ID查询订单项列表
    List<Orderitem> findByOrderId(Integer orderId);

    // 根据订单ID删除订单项
    @Transactional
    @Modifying
    void deleteByOrderId(Integer orderId);
}
